import {
  urls
} from './urls'
export const service = {
  get(url, data, proc, proc_name) {
    var obj = {
      proc: proc,
      proc_name: proc_name
    }
    wx.showLoading({
      title: '加载中...'
    })
    return new Promise((resolve, reject) => {
      wx.request({
        method: 'get',
        url: url,
        data: Object.assign(data, obj),
        header: {
          "content-type": "application/json"
        },
        success: (res) => {
          // 调用接口成功
          resolve(res)
        },
        complete(e) {
          wx.hideLoading()
        },
        fail: (err) => {
          // 调用接口失败
          reject(err)
          wx.hideLoading()
        }
      })
    })
  },
  post(url, data) {
    return new Promise((resolve, reject) => {
      wx.request({
        method: 'post',
        url: url,
        data: data,
        header: {
          "content-type": "application/x-www-form-urlencoded"
        },
        success: (res) => {
          // 调用接口成功
          resolve(res)
        },
        fail: (err) => {
          // 调用接口失败
          reject(err)
        }
      })
    })
  },

}
//
export const proc_name = 'yzwdj_cursor'

//门牌号选择列表
export const property_room_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_room_list', proc_name))
  })
}



//素材下载列表
export const download_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'download_list', proc_name))
  })
}

//素材下载分类
export const download_type = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'download_type', proc_name))
  })
}

//短视频列表
export const video_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'video_list', proc_name))
  })
}


// 检测openid是否已授权过手机号码
export const check_Login = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'check_login', proc_name))
  })
}


// 个人签名提交
export const signature_name_commit = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'signature_name_commit', proc_name))
  })
}


// 业主签名统计
export const owner_sequence_total = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'owner_sequence_total', proc_name))
  })
}

// 业主签名接龙提交
export const owner_sequence_commit = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'owner_sequence_commit', proc_name))
  })
}


// 业主签名接龙清单
export const owner_sequence_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'owner_sequence_list', proc_name))
  })
}

// 业主签名接龙
export const owner_sequence = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'owner_sequence_new', proc_name))
  })
}



// 物业公司提名
export const property_service_submit = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_service_submit', proc_name))
  })
}

// 查询已开放小区
export const property_opened = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_opened', proc_name))
  })
}

// 根据关键字查询物业公司
export const property_service_by_key = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_service_by_key', proc_name))
  })
}


// 通用查询
export const comm_sql = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'comm_sql', proc_name))
  })
}

// 物业公司提名清单
export const property_service_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_service_list', proc_name))
  })
}


// 客服服务清单
export const contact_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'contact_list', proc_name))
  })
}


// 电台播放清单
export const radio_play_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'radio_play_list', proc_name))
  })
}

// 修改节目标题
export const radio_title_update = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'radio_title_update', proc_name))
  })
}

// 获取用户体验数据
export const user_test_auth = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'user_test_auth', proc_name))
  })
}




// 民意调查接口
export const dicide_list_by_civil_mediation = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'dicide_list_by_civil_mediation', proc_name))
  })
}


// 新物业小区注册
export const property_register = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_register_new', proc_name))
  })
}


// 对地图查询已开通小区列表查询
export const property_list_check = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_list_check', proc_name))
  })
}


// 业主签名发起登记
export const signature_send = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'signature_send', proc_name))
  })
}


// 获取默认小区信息
export const get_default_property = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'get_default_property', proc_name))
  })
}

// 获取系统公告信息
export const get_sys_broadcast = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'get_sys_broadcast', proc_name))
  })
}


// 公告目录查询，不含附件
export const queryNotice = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'publish_list', proc_name))
  })
}


//功能表查询
export const get_fun_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'get_fun_list', proc_name))
  })
}
//轮播图片查询
export const img_scrool_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'img_scrool_list', proc_name))
  })
}

//手机号验证实名
export const check_mobile = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'check_mobile', proc_name))
  })
}

//小区模糊检索top10
export const property_search_top = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_search_top10', proc_name))
  })
}

//小程序分享信息查询 
export const share_by_property = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'share_by_property', proc_name))
  })
}

//向后台获取默认参数
export const get_para = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'get_para', proc_name))
  })
}

//小程序关键使用行为记录保存
export const user_log_record = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'user_log_record', proc_name))
  })
}

//用户信息保存 
export const save_userinfo = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'save_userinfo', proc_name))
  })
}


//投票问卷项目目录查询
export const dicide_query = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'dicide_query', proc_name))
  })
}

//投票题目目录查询
export const item_list_query = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'item_list_query', proc_name))
  })
}


//被选答案查询 
export const select_list_query = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'select_list_query', proc_name))
  })
}

//选择答案更新提交
export const answer_commit = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'answer_commit', proc_name))
  })
}
//公告信息阅读
export const broadcast_read = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'broadcast_read', proc_name))
  })
}

//公告附件目录查询
export const publish_appendix_list = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'publish_appendix_list', proc_name))
  })
}

// 实名认证
export const authentication = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'authentication', proc_name))
  })
}

// 小区模糊检索top10 
export const property_search_top10 = (data) => {
  return new Promise((resolve, reject) => {
    resolve(service.get(urls.serviceData, data, 'property_search_top10', proc_name))
  })
}